package com.start.common.jackson;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.start.common.enums.StartBaseStringEnum;

import java.io.IOException;

public class StartEnumStringSerializer extends JsonSerializer<StartBaseStringEnum> {
    @Override
    public void serialize(StartBaseStringEnum startBaseEnum, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
        if (startBaseEnum == null) {
            return;
        }
        String value = startBaseEnum.getValue();
        jsonGenerator.writeString(value);
    }
}
